<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>按键修饰符</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<style>
			.parent {
				border: 1px solid black;
				width: 600px;
				height: 300px;
				padding: 20px;
				background-color: aqua
			}
		</style>
	</head>
	<body>
		<!-- {{}}插值表达式 -->
		<div id="app">
			 <form action="">
				 <input type="text" placeholder="用户名" v-model="uname" @keyup.delete="delHandle"> <br>
				 <input type="password" placeholder="密码"  v-model="pwd" @keyup.enter='submitHandle'> <br>
				 <input type="button" value="登录">
			 </form>
		</div>

		<script>
			//1. 实例化一个Vue的实例
			let vm = new Vue({
				el: '#app', //元素挂载位置(vue实例需要接管的元素,可以使用CSS选择器或者DOM元素)
				data: { //声明模型数据
					uname:'',
					pwd:''
				},
				methods: {
					submitHandle:function(){
						console.log(this.uname,this.pwd);
					} ,
					delHandle:function(){
						this.uname='';
					}
				}
			});
		</script>
	</body>
</html>
